﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace formatingdate
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                
                int[] month1 = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
                int[] month2 = new int[] { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
                Console.WriteLine("Please input  incoming date: \n Year: ");
                int inputyear = Convert.ToInt32(Console.ReadLine());
                if (inputyear >= 1900 && inputyear <= 2100)
                {
                    Console.WriteLine("Please input  incoming date: \n Month: ");
                    int inputmonth = Convert.ToInt32(Console.ReadLine());
                    if (inputmonth >= 1 && inputmonth <= 12)
                    {
                        Console.WriteLine("Please input  incoming date: \n Day: ");
                        int inputday = Convert.ToInt32(Console.ReadLine());
                        int value = inputday;
                        if (inputyear % 4 == 0)
                        {
                            for (int i = 1; i < inputmonth; i++)
                                value = value + month2[i];
                            Console.Write("{0}, days passed from the beginning of  this year\n\n", value);
                        }
                        else
                        {
                            for (int i = 1; i < inputmonth; i++)
                            {
                                value = value + month2[i];

                            }
                            Console.Write("{0}, days passed from the beginning of  this year\n", value);
                            Console.WriteLine();
                        }
                    }
                    else Console.WriteLine("Wrong number, next time input in borders of 1 - 12!");
                }
                else
                    Console.WriteLine("Year doesnt match solution, please input in borders of 1900 - 2100!");
                Console.WriteLine();
                

            }

        }
    } 
}
